<?php

namespace app\api\controller;

use app\admin\model\setting\Banner;
use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    //轮播
    public function banner()
    {
        $lists = Banner::order('sort desc')->select();
        $this->success('请求成功',$lists);
    }

    public function agreement()
    {
        $data = [
            'useragreement'=>\app\common\model\Config::get(['name'=>'useragreement'])->value,
            'privacypolicy'=>\app\common\model\Config::get(['name'=>'privacypolicy'])->value,
        ];
        $this->success('请求成功',$data);
    }

    //系统设置
    public function setting()
    {
        $data = [
            'name'=>\app\common\model\Config::get(['name'=>'name'])->value,
            'logo'=>\app\common\model\Config::get(['name'=>'logo'])->value,
            'index_video'=>\app\common\model\Config::get(['name'=>'index_video'])->value,
            'contact_tel'=>\app\common\model\Config::get(['name'=>'contact_tel'])->value,
            'share_good_id'=>\app\common\model\Config::get(['name'=>'share_good_id'])->value,
        ];
        $this->success('请求成功',$data);
    }
}
